<layout name="layout" />
<form action="{:U('Order/insert')}" method="post" id="form">
    <section class="wrapper marc address">
        <if condition="$user_ext['user_address'] == ''  || empty($area)">
            <script type="text/javascript">var empty_address = 1;</script>
            <header>
                <figcaption>您的地址</figcaption>
            </header>
            <p class="address"><span class="tit">出现错误：</span><span>
                    您尚未添加收货地址,<a href="{:U('user/info/address')}" target="_blank" style="font-weight: bold">点击添加收货地址</a>

                </span></p>
            <p class="address"><span class="tit"></span><span>
                    添加成功后,<a href="javascript:void(0)" id="reload" style="font-weight: bold">点击刷新页面</a>

                </span></p>
            <else/>
            <script type="text/javascript">var empty_address = 0;</script>
            <header>
                <figcaption>您的地址</figcaption>
            </header>
            <p class="address"><span class="tit">收货地址：</span><span>
                    <volist name="area" id="area_val"> {$area_val.name}&nbsp; </volist>
                    {$user_ext.user_address} </span></p>
            <p class="address">
                <span class="tit">收件人：</span>
                <span>{$user_ext.name} - {$user_ext.mobile}</span></p>
            <p class="hints">请确认以上收货信息</p>
        </if>

        <fieldset>
            <p class="button" id="submit">
                <button>确&nbsp;&nbsp;定</button>
            </p>
        </fieldset>
    </section>

</form>
<script type="text/javascript">
    $(document).ready(function() {
        //初始 省、市、区
        ajax_address(0, 'country', '');
        ajax_address('', 'city', '');
        ajax_address('', 'area', '');
        $("#form").submit(function(){
            
        });
        $("#submit").click(function() {
            if (empty_address == 1){
                alert("请添加地址后再下订单!");
                return false;
            }
            $("#form").submit();
        });
        $("#reload").click(function(){
            window.location.reload();
        });
        
    })
</script> 
